#ifndef __SCHEMEBASE_H
#define __SCHEMEBASE_H

#include <stdlib.h>
#include <base.h>
#include <debug.h>

typedef unsigned long Amount ; // might be changed to unsigned int
typedef void* MachineCode ;


/*
 * use this to make sure that the user input is correct.
 * in debug mode, it will also display debug info (where the assert was raised).
 */
#if DEBUG
#define RUNTIME_ASSERT(condition) \
	do \
	{ \
		if (!(condition)) \
		{ \
			DEBUG_YELL("runtime error: condition << %s >> was not met\n", #condition) ; \
			exit(-1) ; \
		} \
	} while (FALSE)
#else
#define RUNTIME_ASSERT(condition) \
	do \
	{ \
		if (!(condition)) \
		{ \
			printf("runtime error: condition << %s >> was not met\n", #condition) ; \
			exit(-1) ; \
		} \
	} while (FALSE)
#endif
//#if DEBUG
#define POSTPROCESS(x) \
	do \
	{ \
		printf("%s\n", sobToString(Sob(x))) ; \
	} while (FALSE)
//#else
//#define POSTPROCESS(x)
//#endif

/* allocate and create copies of strings on the heap */
string stringAlloc(int size) ;
string stringCopy(string source) ;

/*** MEMORY MANAGEMENT ***/
/* this is intended for future support for the garbage collector */

void* autoMalloc(int n) ;
void autoFree(void* p) ;

#endif /* __SCHEMEBASE_H */
